﻿using SH.Common.CommonReturn;
using SH.Room.Domain.RoomClass;
using SH.Room.ErrorCodeEnum;
using SH.Room.Infrastructure.IRepository;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SH.Room.Infrastructure.Repository
{
    public class RoomNumRepository : BaseRepository<RoomNum>, IRoomNumRepository
    {
        private readonly ISqlSugarClient _context;
        public RoomNumRepository(ISqlSugarClient context) : base(DbManger.BizDb)
        {
            _context = DbManger.BizDb;
        }

        /// <summary>
        /// 房号删除
        /// </summary>
        /// <param name="roomId">房号ID</param>
        /// <returns>受影响行数</returns>
        public ApiResult<int> DeleteRoomNumber(int roomId)
        {
            ApiResult<int> apiResult = new ApiResult<int>();
            var item = _context.Deleteable<RoomNum>().Where(x => x.RoomId == roomId).ExecuteCommand();
            
            //apiResult.Error(ApiResult<int>.ErrorType.Request,"房间有人不能删除");
            return apiResult;
        }
    }
}
